package com.antler.smt.admin.controller;

import com.antler.smt.admin.annotation.OperateCut;
import com.antler.smt.request.admin.PeopleReq;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.admin.PeopleManageService;
import com.antler.smt.utils.FormatListUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 工人工程师管理
 *
 * @author zhangyi
 * @date 2018/9/27 16:51
 */
@RestController
@RequestMapping("/peopleManage")
@Api(description = "工人/工程师管理")
public class PeopleManageController {

    @Resource
    private PeopleManageService peopleManageService;


    /**
     * 分类查询工人，工程师
     *
     * @param peopleReq
     * @return
     */
    @GetMapping("/searchPeople")
    @ApiOperation(value = "分类查询工人，工程师",httpMethod = "GET")
    @OperateCut(content = "分类查询工程，工程师(状态使用,分割)")
    public Result searchPeople(PeopleReq peopleReq,String status){

        List<Integer> integerList = FormatListUtil.pareIntLists(status);
        if(null != integerList) {
            peopleReq.setStatus(integerList);
        }
        return peopleManageService.searchPeople(peopleReq);
    }

}
